<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.asm-fasm</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Intel x86 (FASM)) - Theme (Breeze Dark)"/>
</head><body style="background-color:#232629;color:#cfcfc2"><pre>
    <span style="color:#fdbc4b;font-weight:bold;">jmp</span> near <span style="color:#2980b9;">dword</span> [<span style="color:#f67400;">0</span>]
    <span style="color:#fdbc4b;font-weight:bold;">jmp</span> far <span style="color:#2980b9;">dword</span> [<span style="color:#f67400;">0</span>]

    <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">bx</span>,<span style="font-weight:bold;">ax</span>       <span style="color:#7a7c7d;">; general register to general register</span>
    <span style="color:#7f8c8d;">mov</span> [char],<span style="font-weight:bold;">al</span>   <span style="color:#7a7c7d;">; general register to memory</span>
    <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">dl</span>,<span style="color:#f67400;">32</span>       <span style="color:#7a7c7d;">; immediate value to general register</span>
    <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">cr3</span>,<span style="font-weight:bold;">ebx</span>     <span style="color:#7a7c7d;">; general register to control register</span>

    <span style="color:#7f8c8d;">xchg</span> <span style="font-weight:bold;">ax</span>,<span style="font-weight:bold;">bx</span>      <span style="color:#7a7c7d;">; swap two general registers</span>
    <span style="color:#7f8c8d;">xchg</span> <span style="font-weight:bold;">al</span>,[char]  <span style="color:#7a7c7d;">; swap register with memory</span>

    <span style="color:#7f8c8d;">push</span> <span style="font-weight:bold;">ax</span>         <span style="color:#7a7c7d;">; store general register</span>
    <span style="color:#7f8c8d;">push</span> <span style="font-weight:bold;">es</span>         <span style="color:#7a7c7d;">; store segment register</span>
    <span style="color:#7f8c8d;">pushw</span> [<span style="font-weight:bold;">bx</span>]      <span style="color:#7a7c7d;">; store memory</span>
    <span style="color:#7f8c8d;">push</span> <span style="color:#f67400;">1000</span><span style="color:#f67400;">h</span>      <span style="color:#7a7c7d;">; store immediate value</span>

    <span style="color:#7f8c8d;">imul</span> <span style="font-weight:bold;">ax</span>,[<span style="font-weight:bold;">si</span>],<span style="color:#f67400;">10</span> <span style="color:#7a7c7d;">; memory by immediate value to register</span>

    <span style="color:#7f8c8d;">bt</span>  <span style="font-weight:bold;">ax</span>,<span style="color:#f67400;">15</span>        <span style="color:#7a7c7d;">; test bit in register</span>
    <span style="color:#7f8c8d;">bts</span> <span style="color:#2980b9;">word</span> [<span style="font-weight:bold;">bx</span>],<span style="color:#f67400;">15</span> <span style="color:#7a7c7d;">; test and set bit in memory</span>

    <span style="color:#7f8c8d;">bswap</span> <span style="font-weight:bold;">edx</span>        <span style="color:#7a7c7d;">; swap bytes in register</span>

    <span style="color:#fdbc4b;font-weight:bold;">jmp</span> <span style="color:#f67400;">100</span><span style="color:#f67400;">h</span>         <span style="color:#7a7c7d;">; direct near jump</span>
    <span style="color:#fdbc4b;font-weight:bold;">jmp</span> <span style="color:#f67400;">0FFFF</span><span style="color:#f67400;">h</span>:<span style="color:#f67400;">0</span>     <span style="color:#7a7c7d;">; direct far jump</span>
    <span style="color:#fdbc4b;font-weight:bold;">jmp</span> <span style="font-weight:bold;">ax</span>           <span style="color:#7a7c7d;">; indirect near jump</span>
    <span style="color:#fdbc4b;font-weight:bold;">jmp</span> <span style="color:#2980b9;">pword</span> [<span style="font-weight:bold;">ebx</span>]  <span style="color:#7a7c7d;">; indirect far jump</span>

    <span style="color:#7f8c8d;">movs</span> <span style="color:#2980b9;">byte</span> [<span style="font-weight:bold;">di</span>],[<span style="font-weight:bold;">si</span>]        <span style="color:#7a7c7d;">; transfer byte</span>
    <span style="color:#7f8c8d;">movs</span> <span style="color:#2980b9;">word</span> [<span style="font-weight:bold;">es</span>:<span style="font-weight:bold;">di</span>],[<span style="font-weight:bold;">ss</span>:<span style="font-weight:bold;">si</span>]  <span style="color:#7a7c7d;">; transfer word</span>
    <span style="color:#7f8c8d;">movsd</span>                      <span style="color:#7a7c7d;">; transfer double word</span>

    <span style="color:#7f8c8d;">cmpxchg8b</span> [<span style="font-weight:bold;">bx</span>]   <span style="color:#7a7c7d;">; compare and exchange 8 bytes</span>

    <span style="color:#7f8c8d;">movq2dq</span> <span style="font-weight:bold;">xmm0</span>,<span style="font-weight:bold;">mm1</span>   <span style="color:#7a7c7d;">; move from MMX register to SSE register</span>
    <span style="color:#7f8c8d;">movdq2q</span> <span style="font-weight:bold;">mm0</span>,<span style="font-weight:bold;">xmm1</span>   <span style="color:#7a7c7d;">; move from SSE register to MMX register</span>

    <span style="color:#7f8c8d;">enter</span> <span style="color:#f67400;">2048</span>,<span style="color:#f67400;">0</span>     <span style="color:#7a7c7d;">; enter and allocate 2048 bytes on stack</span>

    <span style="color:#7f8c8d;">mov</span> [rip+<span style="color:#f67400;">3</span>],sil    <span style="color:#7a7c7d;">; manual RIP-relative addressing</span>

    <span style="color:#7f8c8d;">blendvps</span> <span style="font-weight:bold;">xmm3</span>,<span style="font-weight:bold;">xmm7</span>,<span style="font-weight:bold;">xmm0</span> <span style="color:#7a7c7d;">; blend according to mask</span>
    <span style="color:#7f8c8d;">vgatherqps</span> <span style="font-weight:bold;">xmm0</span>,[<span style="font-weight:bold;">xmm2</span>],<span style="font-weight:bold;">xmm3</span>        <span style="color:#7a7c7d;">; gather two floats</span>
    <span style="color:#7f8c8d;">vgatherqps</span> <span style="font-weight:bold;">xmm0</span>,[<span style="font-weight:bold;">ymm2</span>+<span style="color:#f67400;">64</span>],<span style="font-weight:bold;">xmm3</span>     <span style="color:#7a7c7d;">; gather four floats</span>
    <span style="color:#7f8c8d;">vfmsub231ps</span> <span style="font-weight:bold;">ymm1</span>,<span style="font-weight:bold;">ymm2</span>,<span style="font-weight:bold;">ymm3</span>     <span style="color:#7a7c7d;">; multiply and subtract</span>
    <span style="color:#7f8c8d;">vfnmadd132sd</span> <span style="font-weight:bold;">xmm0</span>,<span style="font-weight:bold;">xmm5</span>,[<span style="font-weight:bold;">ebx</span>]   <span style="color:#7a7c7d;">; multiply, negate and add</span>
    <span style="color:#7f8c8d;">vpermil2ps</span> <span style="font-weight:bold;">ymm0</span>,<span style="font-weight:bold;">ymm3</span>,<span style="font-weight:bold;">ymm7</span>,<span style="font-weight:bold;">ymm2</span>,<span style="color:#f67400;">0</span>  <span style="color:#7a7c7d;">; permute from two sources</span>

    <span style="color:#7f8c8d;">vscatterdps</span> [<span style="font-weight:bold;">eax</span>+<span style="font-weight:bold;">xmm1</span>]{<span style="font-weight:bold;">k1</span>},<span style="font-weight:bold;">xmm0</span>    <span style="color:#7a7c7d;">; scatter four floats</span>
    <span style="color:#7f8c8d;">vscatterdpd</span> [<span style="font-weight:bold;">ymm3</span>*<span style="color:#f67400;">8</span>]{<span style="font-weight:bold;">k3</span>},<span style="font-weight:bold;">zmm0</span>      <span style="color:#7a7c7d;">; scatter eight doubles</span>

    <span style="color:#2980b9;">dd</span> sum
    x = <span style="color:#f67400;">1</span>
    x = x+<span style="color:#f67400;">2</span>
    sum = x


    <span style="color:#27ae60;">if</span> count&gt;<span style="color:#f67400;">0</span>
        <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">cx</span>,count
        <span style="color:#7f8c8d;">rep</span> <span style="color:#7f8c8d;">movsb</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>


    <span style="color:#27ae60;">if</span> count &amp; ~ count mod <span style="color:#f67400;">4</span>
        <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">cx</span>,count/<span style="color:#f67400;">4</span>
        <span style="color:#7f8c8d;">rep</span> <span style="color:#7f8c8d;">movsd</span>
    <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">if</span> count&gt;<span style="color:#f67400;">4</span>
        <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">cx</span>,count/<span style="color:#f67400;">4</span>
        <span style="color:#7f8c8d;">rep</span> <span style="color:#7f8c8d;">movsd</span>
        <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">cx</span>,count mod <span style="color:#f67400;">4</span>
        <span style="color:#7f8c8d;">rep</span> <span style="color:#7f8c8d;">movsb</span>
    <span style="color:#27ae60;">else</span>
        <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">cx</span>,count
        <span style="color:#7f8c8d;">rep</span> <span style="color:#7f8c8d;">movsb</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>

    <span style="color:#27ae60;">repeat</span> <span style="color:#f67400;">8</span>
        <span style="color:#7f8c8d;">mov</span> <span style="color:#2980b9;">byte</span> [<span style="font-weight:bold;">bx</span>],%
        <span style="color:#7f8c8d;">inc</span> <span style="font-weight:bold;">bx</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">repeat</span>


    s = x/<span style="color:#f67400;">2</span>
    <span style="color:#27ae60;">repeat</span> <span style="color:#f67400;">100</span>
        <span style="color:#27ae60;">if</span> x/s = s
            <span style="color:#27ae60;">break</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
        s = (s+x/s)/<span style="color:#f67400;">2</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">repeat</span>

    <span style="color:#27ae60;">repeat</span> $-$$
        <span style="color:#7f8c8d;">load</span> a <span style="color:#2980b9;">byte</span> from $$+%-<span style="color:#f67400;">1</span>
        <span style="color:#7f8c8d;">store</span> <span style="color:#2980b9;">byte</span> a xor c at $$+%-<span style="color:#f67400;">1</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">repeat</span>

    GDTR <span style="color:#2980b9;">dp</span> ?
    <span style="color:#27ae60;">virtual</span> <span style="color:#27ae60;">at</span> GDTR
        GDT_limit <span style="color:#2980b9;">dw</span> ?
        GDT_address <span style="color:#2980b9;">dd</span> ?
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">virtual</span>

    <span style="color:#27ae60;">virtual</span> <span style="color:#27ae60;">at</span> <span style="color:#f67400;">0</span>
        <span style="color:#2980b9;">file</span> <span style="color:#f44f4f;">'a.txt'</span>:<span style="color:#f67400;">10</span><span style="color:#f67400;">h</span>,<span style="color:#f67400;">1</span>
        <span style="color:#7f8c8d;">load</span> char from <span style="color:#f67400;">0</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">virtual</span>

    <span style="color:#27ae60;">virtual</span> <span style="color:#27ae60;">at</span> <span style="color:#f67400;">0</span> as <span style="color:#f44f4f;">'asc'</span>
        <span style="color:#27ae60;">times</span> <span style="color:#f67400;">256</span> <span style="color:#2980b9;">db</span> %-<span style="color:#f67400;">1</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">virtual</span>

    <span style="color:#27ae60;">virtual</span> <span style="color:#27ae60;">at</span> <span style="color:#f67400;">0</span>
        <span style="color:#8e44ad;">hex_digits:</span>:
        <span style="color:#2980b9;">db</span> <span style="color:#f44f4f;">'0123456789ABCDEF'</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">virtual</span>
    <span style="color:#7f8c8d;">load</span> a <span style="color:#2980b9;">byte</span> from hex_digits:<span style="color:#f67400;">10</span>

    bits = <span style="color:#f67400;">16</span>
    <span style="color:#27ae60;">display</span> <span style="color:#f44f4f;">'Current offset is 0x'</span>
    <span style="color:#27ae60;">repeat</span> bits/<span style="color:#f67400;">4</span>
        d = <span style="color:#f44f4f;">'0'</span> + $ shr (bits-%*<span style="color:#f67400;">4</span>) and <span style="color:#f67400;">0F</span><span style="color:#f67400;">h</span>
        <span style="color:#27ae60;">if</span> d &gt; <span style="color:#f44f4f;">'9'</span>
            d = d + <span style="color:#f44f4f;">'A'</span>-<span style="color:#f44f4f;">'9'</span>-<span style="color:#f67400;">1</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
        <span style="color:#27ae60;">display</span> d
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">repeat</span>
    <span style="color:#27ae60;">display</span> <span style="color:#f67400;">13</span>,<span style="color:#f67400;">10</span>

    <span style="color:#27ae60;">if</span> ~ defined alpha
        <span style="color:#8e44ad;">alpha:</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>

    <span style="color:#27ae60;">if</span> ~ defined alpha | defined <span style="color:#8e44ad;">@f</span>
        <span style="color:#8e44ad;">alpha:</span>
        <span style="color:#8e44ad;">@@:</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>

    <span style="color:#7f8c8d;">include</span> <span style="color:#f44f4f;">'macros.inc'</span>

    d equ <span style="color:#2980b9;">dword</span>
    NULL equ d <span style="color:#f67400;">0</span>
    d equ <span style="font-weight:bold;">edx</span>

    d equ d,<span style="font-weight:bold;">eax</span>

    b equ <span style="color:#2980b9;">byte</span>
    w equ <span style="color:#2980b9;">word</span>
    d equ <span style="color:#2980b9;">dword</span>
    p equ <span style="color:#2980b9;">pword</span>
    f equ <span style="color:#2980b9;">fword</span>
    q equ <span style="color:#2980b9;">qword</span>
    t equ <span style="color:#2980b9;">tword</span>
    x equ <span style="color:#2980b9;">dqword</span>
    y equ <span style="color:#2980b9;">qqword</span>

    incl fix include

    <span style="color:#27ae60;">macro</span> tst {<span style="color:#7f8c8d;">test</span> <span style="font-weight:bold;">al</span>,<span style="color:#f67400;">0x</span><span style="color:#f67400;">FF</span>}

    <span style="color:#27ae60;">macro</span> stos0
     {
        <span style="color:#7f8c8d;">xor</span> <span style="font-weight:bold;">al</span>,<span style="font-weight:bold;">al</span>
        <span style="color:#7f8c8d;">stosb</span>
     }

    <span style="color:#27ae60;">macro</span> align value { <span style="color:#2980b9;">rb</span> (value-<span style="color:#f67400;">1</span>)-($+value-<span style="color:#f67400;">1</span>) mod value }

    <span style="color:#27ae60;">macro</span> mov op1,op2
     {
      <span style="color:#27ae60;">if</span> op1 in &lt;<span style="font-weight:bold;">ds</span>,<span style="font-weight:bold;">es</span>,<span style="font-weight:bold;">fs</span>,<span style="font-weight:bold;">gs</span>,<span style="font-weight:bold;">ss</span>&gt; &amp; op2 in &lt;<span style="font-weight:bold;">cs</span>,<span style="font-weight:bold;">ds</span>,<span style="font-weight:bold;">es</span>,<span style="font-weight:bold;">fs</span>,<span style="font-weight:bold;">gs</span>,<span style="font-weight:bold;">ss</span>&gt;
        <span style="color:#7f8c8d;">push</span>  op2
        <span style="color:#7f8c8d;">pop</span>   op1
      <span style="color:#27ae60;">else</span>
        <span style="color:#7f8c8d;">mov</span>   op1,op2
      <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
     }

    <span style="color:#27ae60;">macro</span> stoschar [char]
     {
        <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">al</span>,char
        <span style="color:#7f8c8d;">stosb</span>
     }

    <span style="color:#27ae60;">macro</span> movstr
     {
        <span style="color:#27ae60;">local</span> move
      <span style="color:#8e44ad;">move:</span>
        <span style="color:#7f8c8d;">lodsb</span>
        <span style="color:#7f8c8d;">stosb</span>
        <span style="color:#7f8c8d;">test</span> <span style="font-weight:bold;">al</span>,<span style="font-weight:bold;">al</span>
        <span style="color:#fdbc4b;font-weight:bold;">jnz</span> move
     }

    <span style="color:#27ae60;">macro</span> strtbl name,[string]
     {
      <span style="color:#27ae60;">common</span>
        <span style="color:#27ae60;">label</span> name <span style="color:#2980b9;">dword</span>
      forward
        <span style="color:#27ae60;">local</span> label
        <span style="color:#2980b9;">dd</span> label
      forward
        <span style="color:#27ae60;">label</span> <span style="color:#2980b9;">db</span> string,<span style="color:#f67400;">0</span>
     }

    <span style="color:#7f8c8d;">push</span> <span style="color:#f67400;">3</span>
    <span style="color:#7f8c8d;">push</span> <span style="color:#f67400;">2</span>
    <span style="color:#7f8c8d;">push</span> <span style="color:#f67400;">1</span>
    <span style="color:#fdbc4b;font-weight:bold;">call</span> foo

    <span style="color:#27ae60;">macro</span> invoke proc,[arg]
     { <span style="color:#27ae60;">common</span> stdcall [proc],arg }

    <span style="color:#27ae60;">macro</span> jif op1,cond,op2,label
     {
        <span style="color:#7f8c8d;">cmp</span> op1,op2
        j#cond label
     }

    <span style="color:#27ae60;">macro</span> label name
     {
        <span style="color:#27ae60;">label</span> name
        <span style="color:#27ae60;">if</span> ~ used name
          <span style="color:#27ae60;">display</span> `name # <span style="color:#f44f4f;">&quot; is defined but not used.&quot;</span>,<span style="color:#f67400;">13</span>,<span style="color:#f67400;">10</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
     }

    <span style="color:#27ae60;">macro</span> message arg
     {
      <span style="color:#27ae60;">if</span> arg eqtype <span style="color:#f44f4f;">&quot;&quot;</span>
        <span style="color:#27ae60;">local</span> str
        <span style="color:#fdbc4b;font-weight:bold;">jmp</span>   <span style="color:#8e44ad;">@f</span>
        <span style="color:#7f8c8d;">str</span>   <span style="color:#2980b9;">db</span> arg,<span style="color:#f67400;">0D</span><span style="color:#f67400;">h</span>,<span style="color:#f67400;">0A</span><span style="color:#f67400;">h</span>,<span style="color:#f67400;">24</span><span style="color:#f67400;">h</span>
        <span style="color:#8e44ad;">@@:</span>
        <span style="color:#7f8c8d;">mov</span>   <span style="font-weight:bold;">dx</span>,str
      <span style="color:#27ae60;">else</span>
        <span style="color:#7f8c8d;">mov</span>   <span style="font-weight:bold;">dx</span>,arg
      <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
        <span style="color:#7f8c8d;">mov</span>   <span style="font-weight:bold;">ah</span>,<span style="color:#f67400;">9</span>
        <span style="color:#7f8c8d;">int</span>   <span style="color:#f67400;">21</span><span style="color:#f67400;">h</span>
     }

    <span style="color:#27ae60;">macro</span> ext instr
     {
      <span style="color:#27ae60;">macro</span> instr op1,op2,op3
       \{
        <span style="color:#27ae60;">if</span> op3 eq
          instr op1,op2
        <span style="color:#27ae60;">else</span>
          instr op1,op2
          instr op2,op3
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
       \}
     }

    ext add
    ext sub


    <span style="color:#27ae60;">macro</span> tmacro [params]
     {
      <span style="color:#27ae60;">common</span> macro params {
     }
    <span style="color:#27ae60;">MACRO</span> fix tmacro
    ENDM fix }


    <span style="color:#27ae60;">MACRO</span> stoschar char
        <span style="color:#7f8c8d;">mov</span> <span style="font-weight:bold;">al</span>,char
        <span style="color:#7f8c8d;">stosb</span>
    ENDM

    <span style="color:#27ae60;">postpone</span>
     {
      code_size = $
     }

    <span style="color:#27ae60;">struc</span> point x,y
     {
        .x <span style="color:#2980b9;">dw</span> x
        .y <span style="color:#2980b9;">dw</span> y
     }

    <span style="color:#27ae60;">struc</span> <span style="color:#2980b9;">db</span> [data]
     {
       <span style="color:#27ae60;">common</span>
        . <span style="color:#2980b9;">db</span> data
        .size = $ - .
     }

    <span style="color:#27ae60;">rept</span> <span style="color:#f67400;">5</span> { <span style="color:#7f8c8d;">in</span> <span style="font-weight:bold;">al</span>,<span style="font-weight:bold;">dx</span> }

    <span style="color:#27ae60;">rept</span> <span style="color:#f67400;">3</span> counter
     {
        byte#counter <span style="color:#2980b9;">db</span> counter
     }

    <span style="color:#27ae60;">match</span> +,+ { <span style="color:#7f8c8d;">include</span> <span style="color:#f44f4f;">'first.inc'</span> }
    <span style="color:#27ae60;">match</span> +,- { <span style="color:#7f8c8d;">include</span> <span style="color:#f44f4f;">'second.inc'</span> }
    <span style="color:#27ae60;">match</span> a b, <span style="color:#f67400;">1</span>+<span style="color:#f67400;">2</span>+<span style="color:#f67400;">3</span> { <span style="color:#2980b9;">db</span> a }

    V fix {
      <span style="color:#27ae60;">macro</span> empty
       V
    V fix }
       V


    list equ

    <span style="color:#27ae60;">macro</span> append item
     {
       <span style="color:#27ae60;">match</span> any, list \{ list equ list,item \}
       <span style="color:#27ae60;">match</span> , list \{ list equ item \}
     }

    define a b+<span style="color:#f67400;">4</span>
    define b <span style="color:#f67400;">3</span>
    <span style="color:#27ae60;">rept</span> <span style="color:#f67400;">1</span> result:a*b+<span style="color:#f67400;">2</span> { define c result }

    <span style="color:#27ae60;">rept</span> <span style="color:#f67400;">8</span> n:<span style="color:#f67400;">0</span> { <span style="color:#7f8c8d;">pxor</span> xmm#n,xmm#n }


   <span style="color:#27ae60;">irps</span> reg, <span style="font-weight:bold;">al</span> <span style="font-weight:bold;">bx</span> <span style="font-weight:bold;">ecx</span>
    { <span style="color:#7f8c8d;">xor</span> reg,reg }


    <span style="color:#27ae60;">if</span> <span style="color:#f67400;">0</span>
    a = <span style="color:#f67400;">1</span>
    b equ <span style="color:#f67400;">2</span>
    <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
    <span style="color:#2980b9;">dd</span> b


    <span style="color:#7f8c8d;">extrn</span> exit
    <span style="color:#7f8c8d;">extrn</span> <span style="color:#f44f4f;">'__imp__MessageBoxA@16'</span> as MessageBox:<span style="color:#2980b9;">dword</span>

    <span style="color:#7f8c8d;">extrn</span> <span style="color:#f44f4f;">'printf'</span> as _printf
    printf = PLT _printf

    tester? = <span style="color:#f67400;">0</span>

        <span style="color:#8e44ad;">space:</span>
        space.x = <span style="color:#f67400;">1</span>
        space.y = <span style="color:#f67400;">2</span>
        <span style="color:#8e44ad;">space.color:</span>
        space.color.r = <span style="color:#f67400;">0</span>
        space.color.g = <span style="color:#f67400;">0</span>
        space.color.b = <span style="color:#f67400;">0</span>

        <span style="color:#8e44ad;">space:</span>
        <span style="color:#27ae60;">namespace</span> space
                x = <span style="color:#f67400;">1</span>
                y = <span style="color:#f67400;">2</span>
                <span style="color:#8e44ad;">color:</span>
                .r = <span style="color:#f67400;">0</span>
                .g = <span style="color:#f67400;">0</span>
                .b = <span style="color:#f67400;">0</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">namespace</span>


        <span style="color:#8e44ad;">first:</span>
                .child = <span style="color:#f67400;">1</span>
                ..other = <span style="color:#f67400;">0</span>
        <span style="color:#8e44ad;">second:</span>
                .child = <span style="color:#f67400;">2</span>
                ..another = ..other


        <span style="color:#27ae60;">label</span> character:<span style="color:#2980b9;">byte</span>
        <span style="color:#27ae60;">label</span> char:<span style="color:#f67400;">1</span>

        <span style="color:#2980b9;">byte</span>? = <span style="color:#f67400;">1</span>       <span style="color:#7a7c7d;">; 8 bits</span>
        <span style="color:#2980b9;">word</span>? = <span style="color:#f67400;">2</span>       <span style="color:#7a7c7d;">; 16 bits</span>
        <span style="color:#2980b9;">dword</span>? = <span style="color:#f67400;">4</span>      <span style="color:#7a7c7d;">; 32 bits</span>
        <span style="color:#2980b9;">fword</span>? = <span style="color:#f67400;">6</span>      <span style="color:#7a7c7d;">; 48 bits</span>
        <span style="color:#2980b9;">pword</span>? = <span style="color:#f67400;">6</span>      <span style="color:#7a7c7d;">; 48 bits</span>
        <span style="color:#2980b9;">qword</span>? = <span style="color:#f67400;">8</span>      <span style="color:#7a7c7d;">; 64 bits</span>
        <span style="color:#2980b9;">tbyte</span>? = <span style="color:#f67400;">10</span>     <span style="color:#7a7c7d;">; 80 bits</span>
        <span style="color:#2980b9;">tword</span>? = <span style="color:#f67400;">10</span>     <span style="color:#7a7c7d;">; 80 bits</span>
        <span style="color:#2980b9;">dqword</span>? = <span style="color:#f67400;">16</span>    <span style="color:#7a7c7d;">; 128 bits</span>
        <span style="color:#2980b9;">xword</span>? = <span style="color:#f67400;">16</span>     <span style="color:#7a7c7d;">; 128 bits</span>
        <span style="color:#2980b9;">qqword</span>? = <span style="color:#f67400;">32</span>    <span style="color:#7a7c7d;">; 256 bits</span>
        <span style="color:#2980b9;">yword</span>? = <span style="color:#f67400;">32</span>     <span style="color:#7a7c7d;">; 256 bits</span>
        <span style="color:#2980b9;">dqqword</span>? = <span style="color:#f67400;">64</span>   <span style="color:#7a7c7d;">; 512 bits</span>
        <span style="color:#2980b9;">zword</span>? = <span style="color:#f67400;">64</span>     <span style="color:#7a7c7d;">; 512 bits</span>

        element A
        linpoly = A + A + <span style="color:#f67400;">3</span>
        vterm = linpoly scale <span style="color:#f67400;">1</span> * linpoly element <span style="color:#f67400;">1</span>     <span style="color:#7a7c7d;">; vterm = 2 * A</span>

        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">4</span> dup <span style="color:#f67400;">90</span><span style="color:#f67400;">h</span>            <span style="color:#7a7c7d;">; generate 4 bytes</span>
        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">2</span> dup (<span style="color:#f44f4f;">'abc'</span>,<span style="color:#f67400;">10</span>)     <span style="color:#7a7c7d;">; generate 8 bytes</span>

        <span style="color:#27ae60;">macro</span> measured name,string
                <span style="color:#27ae60;">local</span> top
                name <span style="color:#2980b9;">db</span> string
                <span style="color:#8e44ad;">top:</span> name.length = top - name
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">macro</span>

        measured hello, <span style="color:#f44f4f;">'Hello!'</span>        <span style="color:#7a7c7d;">; hello.length = 6</span>

        A equ <span style="color:#f67400;">1</span>
        A equ <span style="color:#f67400;">2</span>

        drop A
        drop A

        data1 <span style="color:#2980b9;">dw</span> <span style="color:#f67400;">1</span>
        buffer1 <span style="color:#2980b9;">rb</span> <span style="color:#f67400;">10</span><span style="color:#f67400;">h</span>          <span style="color:#7a7c7d;">; zeroed and present in the output</span>

        <span style="color:#7f8c8d;">org</span> <span style="color:#f67400;">400</span><span style="color:#f67400;">h</span>
        <span style="color:#7f8c8d;">data</span> <span style="color:#2980b9;">dw</span> <span style="color:#f67400;">2</span>
        buffer2 <span style="color:#2980b9;">rb</span> <span style="color:#f67400;">20</span><span style="color:#f67400;">h</span>          <span style="color:#7a7c7d;">; not in the output</span>

        <span style="color:#7f8c8d;">section</span> <span style="color:#f67400;">1000</span><span style="color:#f67400;">h</span>
        data3 <span style="color:#2980b9;">dw</span> <span style="color:#f67400;">3</span>
        buffer3 <span style="color:#2980b9;">rb</span> <span style="color:#f67400;">30</span><span style="color:#f67400;">h</span>          <span style="color:#7a7c7d;">; not in the output</span>

        <span style="color:#27ae60;">virtual</span> <span style="color:#27ae60;">at</span> <span style="color:#f67400;">0</span>
                <span style="color:#8e44ad;">hex_digits:</span>:
                <span style="color:#2980b9;">db</span> <span style="color:#f44f4f;">'0123456789ABCDEF'</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">virtual</span>
        <span style="color:#7f8c8d;">load</span> a:<span style="color:#2980b9;">byte</span> from hex_digits:<span style="color:#f67400;">10</span>  <span style="color:#7a7c7d;">; a = 'A'</span>

        <span style="color:#2980b9;">db</span> <span style="color:#f44f4f;">&quot;Text&quot;</span>
        key = <span style="color:#f67400;">7B</span><span style="color:#f67400;">h</span>
        <span style="color:#27ae60;">repeat</span> $-$$
                <span style="color:#7f8c8d;">load</span> a : <span style="color:#2980b9;">byte</span> from $$+%-<span style="color:#f67400;">1</span>
                <span style="color:#7f8c8d;">store</span> a xor key : <span style="color:#2980b9;">byte</span> at $$+%-<span style="color:#f67400;">1</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">repeat</span>

        <span style="color:#7f8c8d;">load</span> char : <span style="color:#2980b9;">byte</span> from const:<span style="color:#f67400;">0</span>

        <span style="color:#27ae60;">if</span> $&gt;<span style="color:#f67400;">10000</span><span style="color:#f67400;">h</span>
                <span style="color:#27ae60;">err</span> <span style="color:#f44f4f;">'segment too large'</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span>
        <span style="color:#27ae60;">calminstruction</span> please? cmd&amp;
                <span style="color:#27ae60;">match</span> =do? =not? cmd, cmd
                jyes done
                assemble cmd
            <span style="color:#8e44ad;">done:</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">calminstruction</span>

        please do not display <span style="color:#f44f4f;">'Bye!'</span>

        <span style="color:#27ae60;">macro</span> jmpi target
                <span style="color:#27ae60;">if</span> target-($+<span style="color:#f67400;">2</span>) &lt; <span style="color:#f67400;">80</span><span style="color:#f67400;">h</span> &amp; target-($+<span style="color:#f67400;">2</span>) &gt;= -<span style="color:#f67400;">80</span><span style="color:#f67400;">h</span>                    
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0EB</span><span style="color:#f67400;">h</span>
                        <span style="color:#2980b9;">db</span> target-($+<span style="color:#f67400;">1</span>)
                <span style="color:#27ae60;">else</span>
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0E9</span><span style="color:#f67400;">h</span>
                        <span style="color:#2980b9;">dw</span> target-($+<span style="color:#f67400;">2</span>)
                <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">if</span> 
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">macro</span>

        <span style="color:#27ae60;">macro</span> EX? first,second
                <span style="color:#27ae60;">match</span> (=<span style="font-weight:bold;">SP</span>?), first
                        <span style="color:#27ae60;">match</span> =HL?, second
                                <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0E3</span><span style="color:#f67400;">h</span>
                        <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">match</span> =IX?, second
                                <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0DD</span><span style="color:#f67400;">h</span>,<span style="color:#f67400;">0E3</span><span style="color:#f67400;">h</span>
                        <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">match</span> =IY?, second
                                <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0FD</span><span style="color:#f67400;">h</span>,<span style="color:#f67400;">0E3</span><span style="color:#f67400;">h</span>
                        <span style="color:#27ae60;">else</span>
                                <span style="color:#27ae60;">err</span> <span style="color:#f44f4f;">&quot;incorrect second argument&quot;</span>
                        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">match</span>
                <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">match</span> =AF?, first
                        <span style="color:#27ae60;">match</span> =AF<span style="color:#f44f4f;">'?, second</span>
                                <span style="color:#2980b9;">db</span> <span style="color:#f67400;">08</span><span style="color:#f67400;">h</span>
                        <span style="color:#27ae60;">else</span>
                                <span style="color:#27ae60;">err</span> <span style="color:#f44f4f;">&quot;incorrect second argument&quot;</span>
                        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">match</span>
                <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">match</span> =DE?, first
                        <span style="color:#27ae60;">match</span> =HL?, second
                                <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0EB</span><span style="color:#f67400;">h</span>
                        <span style="color:#27ae60;">else</span>
                                <span style="color:#27ae60;">err</span> <span style="color:#f44f4f;">&quot;incorrect second argument&quot;</span>
                        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">match</span>
                <span style="color:#27ae60;">else</span>
                        <span style="color:#27ae60;">err</span> <span style="color:#f44f4f;">&quot;incorrect first argument&quot;</span>
                <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">match</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">macro</span>

        EX (<span style="font-weight:bold;">SP</span>),HL

        <span style="color:#27ae60;">macro</span> INC? argument
                <span style="color:#27ae60;">match</span> [:r:], argument
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">100</span><span style="color:#f67400;">b</span> + r shl <span style="color:#f67400;">3</span>
                <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">match</span> (=HL?), argument
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">34</span><span style="color:#f67400;">h</span>
                <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">match</span> (=IX?+d), argument
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0DD</span><span style="color:#f67400;">h</span>,<span style="color:#f67400;">34</span><span style="color:#f67400;">h</span>,d
                <span style="color:#27ae60;">else</span> <span style="color:#27ae60;">match</span> (=IY?+d), argument
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0FD</span><span style="color:#f67400;">h</span>,<span style="color:#f67400;">34</span><span style="color:#f67400;">h</span>,d
                <span style="color:#27ae60;">else</span>
                        <span style="color:#27ae60;">err</span> <span style="color:#f44f4f;">&quot;incorrect argument&quot;</span>
                <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">match</span>
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">macro</span>

        <span style="color:#7f8c8d;">INC</span> (IX+<span style="color:#f67400;">2</span>)

        element IY? 

        element L? : register + <span style="color:#f67400;">101</span><span style="color:#f67400;">b</span>

        <span style="color:#27ae60;">macro</span> CALL? arguments&amp;
                <span style="color:#27ae60;">local</span> cc,nn
                <span style="color:#27ae60;">match</span> condition =, target, arguments
                        cc = condition - CC
                        nn = target
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0C4</span><span style="color:#f67400;">h</span> + cc shl <span style="color:#f67400;">3</span>
                <span style="color:#27ae60;">else</span>
                        nn = arguments
                        <span style="color:#2980b9;">db</span> <span style="color:#f67400;">0CD</span><span style="color:#f67400;">h</span>                     
                <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">match</span>
                <span style="color:#2980b9;">dw</span> nn
        <span style="color:#27ae60;">end</span> <span style="color:#27ae60;">macro</span>
</pre></body></html>
